home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Utilities.h
-
- Contains: Location Manager SDK Sample Module handy routines
-
- Version: ALM SDK 2.0
- Package: Location Manager SDK 2.0
-
- Copyright: © 1996-1997 by Apple Computer, Inc.
- All rights reserved.
-
- Bugs?: Please include the the file and version information (from above) with
- the problem description. Developers belonging to one of the Apple
- developer programs can submit bug reports to:
-
- devsupport@apple.com
-
- */
-
- #ifndef __UTILITIES__
- #define __UTILITIES__
-
- // -------------------------------------------------------------------------------------------------
-
- // MacOS Includes...
-
- #include <Components.h>
- #include <LocationManager.h>
- #include <Processes.h>
- #include <Quickdraw.h>
-
- // -------------------------------------------------------------------------------------------------
-
- // Module-specific defines...
-
- #define kModuleVersion 0
-
- // We didn't actually change the setting format between SDK 1.0 and 2.0, but this was a
- // convenient way to call out the problem; see the discussion at "UseSetting" in Utilities.c...
-
- #define kOldSettingVersion 1 // From SDK 1.0
- #define kSettingVersion 2 // Current settings...
-
- // -------------------------------------------------------------------------------------------------
-
- // Types...
-
- typedef struct {
- UInt32 dateCreated; // Date file created &
- UInt32 dateModified; // Date file modified == "changed" indicator...
- UInt32 dataForkOffset; // Relative position of data fork data...
- UInt32 dataForkLen; // Length of data fork data...
- UInt32 resForkOffset; // Resource fork data position...
- UInt32 resForkLen; // Length of resource fork data...
- } FileInfoRec, *FileInfoPtr;
-
- typedef struct {
- Component self; // Reference back to ourselves for closure...
- SInt32 resFile; // Reference for our open resource fork...
- UInt32 fileCount; // Number of records below...
- FSSpec theFiles[kVariableLengthArray];
- } Globals, *GlobalsPtr, **GlobalsHandle;
-
- typedef struct {
- UInt32 version; // Version of the setting...
- UInt32 fileCount; // Number of records below...
- FileInfoRec fileInfo[kVariableLengthArray];
- // actual file data follows array...
- } SettingRec, *SettingPtr, **SettingHandle;
-
- // -------------------------------------------------------------------------------------------------
-
- // Exports...
-
- extern OSErr
- UseSetting (GlobalsHandle globals, SettingHandle setting, ALMRebootFlags* flags);
- // Make 'setting' the current setting...
-
- extern OSErr
- ReadSetting (GlobalsHandle globals, SettingHandle setting);
- // Read the system state into setting...
-
- extern OSErr
- ConfirmFSSpecs (GlobalsHandle globals);
- // Ensure that the FSSpec array in globals conforms to the resource list of files
- // to look for...
-
- extern void
- InsParamStr (StringPtr matchThis, StringPtr replaceWithThis, StringPtr replaceInThis);
- // Insert 'replaceWithThis' into 'replaceInThis' at the first instance of
- // 'matchThis'...
-
- extern OSErr
- LaunchApplications (LaunchFlags theFlags);
- // Launch all the applications in the resource in question...
-
- // -------------------------------------------------------------------------------------------------
-
- #endif // __UTILITIES__
-